<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /* 
        创建对象的语法
        方式1   new objec（）

        方式2 {属性名：属性值,... ...,函数名：function（）{}}
        
        */
       var person=new Object()
       /* person.name="老王"
       person.age=19
       person.eat=function(food){
        document.write(this.age+"岁"+this.name+"吃"+food)
       }
       console.log(person.name);
       console.log(person.age);
       person.eat("火锅") */
       var person={
            name:"张三",
            age:10,
            eat:function(food){
                document.write(this.age+"岁"+this.name+"吃"+food)
            }
       }
       console.log(person.name);
       console.log(person.age);
       person.eat("火锅")
       
    </script>
</head>
<body>
    
</body>
</html>